import React from 'react';
import {inject, observer} from 'mobx-react';
import { WeaErrorPage, WeaDialog, WeaTop, WeaTab, WeaRightMenu, WeaNewScroll, WeaInput, WeaBrowser, WeaTools, WeaAuth  } from 'ecCom';
import {Row, Button, Spin, Col, Input, Modal} from 'antd';
import {observable, action, toJS} from 'mobx';
import {WeaTableNew} from 'comsMobx';
import RoomCreate from './RoomCreate.js'
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
const WeaTable = WeaTableNew.WeaTable;
const confirm = Modal.confirm;

@inject('meetingRoom')
@observer
class RoomShareDialog extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            spinning: true,
        }
    }

    componentDidMount() {
    }
    componentWillReceiveProps(nextProps) {
        
    }
    render() {
        const {meetingRoom} = this.props;
        let {spinning} = meetingRoom;
        let title = getLabel(383335,"添加共享范围");
        return (
            <div className="workPlan-dialog" id="workPlan-createWorkPlan-id">

                <WeaAuth
                    icon={'icon-coms-meeting'}
                    iconBgcolor={'#0079de'}
                    title={title}
                    visible={meetingRoom.showAddShareFlag}
                    conditions={toJS(meetingRoom.shareFields)}
                    onOk={data => {
                        meetingRoom.saveShare(data);
                    }}
                    onCancel={() => {
                        meetingRoom.closeShare()
                    }}
                >
                </WeaAuth>
            </div>
        )
    }

    getButton(){
        let btns = [];
        btns.push(<Button type="primary" onClick={() => this.doSave() }>{getLabel(383323,"保存")}</Button>);
        btns.push(<Button type="ghost" onClick={() => { this.doClose() } }>{getLabel(128845,"关闭")}</Button>);
        return btns;
    }

    doSave(){
        let {meetingRoom} = this.props;
        let alldatas = meetingRoom.addShareForm.getFormParams();

        // meetingRoom.doSave(alldatas).then(rdata => {
        //     meetingRoom.getRoomList(meetingRoom.adSearchForm.getFormParams());
        //     this.doClose();
        // });
    }


    doClose = () => {
        this.props.doClose && this.props.doClose()
    }
}

export default RoomShareDialog
